package entities;

import java.io.Serializable;
import javax.persistence.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * The persistent class for the doctor database table.
 * 
 */
@Entity
@Table(name = "doctor")
public class Doctor implements Serializable {
	private static final long serialVersionUID = 1L;
	private int idDoctor;
	private BigDecimal charges;
	private Employee employee;
	private List<ExamineDetail> examineDetails;

	public Doctor() {
	}

	public Doctor(BigDecimal charges, Employee employee) {
		super();
		this.charges = charges;
		this.employee = employee;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(unique = true, nullable = false)
	public int getIdDoctor() {
		return this.idDoctor;
	}

	public void setIdDoctor(int idDoctor) {
		this.idDoctor = idDoctor;
	}

	@Column(nullable = false, precision = 10)
	public BigDecimal getCharges() {
		return this.charges;
	}

	public void setCharges(BigDecimal charges) {
		this.charges = charges;
	}

	// bi-directional many-to-one association to Employee
	@ManyToOne
	@JoinColumn(name = "idEmployee", nullable = false)
	public Employee getEmployee() {
		return this.employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	// bi-directional many-to-one association to ExamineDetail
	@OneToMany(mappedBy = "doctor", fetch = FetchType.EAGER)
	public List<ExamineDetail> getExamineDetails() {
		return this.examineDetails;
	}

	public void setExamineDetails(List<ExamineDetail> examineDetails) {
		this.examineDetails = examineDetails;
	}

	@Override
	public String toString() {
		return this.getClass().getName() + "[ " + idDoctor + " | " + charges + " | "
				+ employee.getIdEmployee() + " ]";
	}

}